<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <title>Document</title>
</head>

<body>
    <div id="app">
        <p>{{message}}</p>
        <button @click="reverseMessage" style="color: brown;">反转消息</button>
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                message: '土地老儿'
            },
            methods: {
                reverseMessage: function () {
                    this.message = this.message.split('').reverse().join('')
                }
            }
        });
    </script>
    <hr>

    <div id="app1">
        <ul>

            <li v-for="x in list">
                {{x.text}}----{{x.address}}
            </li>
        </ul>
    </div>
    <script>
        var app1 = new Vue({
            el: "#app1",
            data: {
                list: [
                    {
                        text: "篮球",
                        address: '蔡徐坤'
                    },
                    {
                        text: "皮革厂",
                        address: "浙江"
                    },
                    {
                        text: "春天",
                        address: "来了"
                    }
                ]
            }
        })
    </script>
    <hr>
    <div id="app2">
        <div>{{ fg }}</div>
        <input v-model="fg">

        <div>{{ x }}</div>
    </div>
    <script>
        var app2=new Vue({
            el:"#app2",
            data:{
                fg:"你好啊",
                x:""
            },
            beforeCreate(){
                console.log(" beforeCreate钩子被调用了")
            },
            //created 和data是平级
            created:function(){
                    this.x="小伙子"
                    console.log("实现created钩子")
                },
            beforeMount(){
                console.log("beforeMount钩子被调用了")
            },
            mounted(){
                console.log("mounted钩子被调用了")
            },
            beforeUpdate(){
                console.log("beforeUpdate钩子被调用了")
            },
            updated(){
                console.log("updated被调用了")
            },
            beforeDestyoy(){
                console.log("beforeDestyoy被调用了")
            }
        });
    
    </script>

</body>

</html>